<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * TwoHome
 *
 * @package		TwoHome
 * @author		TwoHome Dev Team
 * @copyright	Copyright (c) 20012 - 2015, TwoHome
 * @since		Version 1.0
 */

// ------------------------------------------------------------------------

/**
 * th_url URL Helpers
 *
 * @package		TwoHome
 * @subpackage	Libraries
 * @category	      URL
 * @author		      TwoHome Dev Team
 * @link		
 */
	// --------------------------------------------------------------------

	/**
	 * CSS file url
	 *
	 * 获得CSS文件的url
	 *
	 * @param	string	主题名称
	 * @param	string	css文件名
	 * @return	string
	 */
if ( ! function_exists('th_css_url'))
{
	function th_css_url($file = '', $theme = 'default')
	{
		$CI =& get_instance();
		$config =& get_config();
		$CI->load->helper('url');
		
		$base = base_url();
		$_theme_path = $base.$config['th_theme_path'];
		
		return $_theme_path.'/'.$theme.'/'.$file;
	}
}
	// --------------------------------------------------------------------

	/**
	 * javascript file url
	 *
	 * 获得公共js文件的url
	 *
	 * @param	string	
	 * @return	string
	 */
if ( ! function_exists('th_js_url'))
{
	function th_js_url($file = '')
	{
		$CI =& get_instance();
		$config =& get_config();
		$CI->load->helper('url');
		
		$base = base_url();
		$_js_path = $base.$config['th_js_path'];
		
		return $_js_path.'/'.$file;
	}
}
	// --------------------------------------------------------------------

	/**
	 * images file url
	 *
	 * 获得公共图像文件的url
	 *
	 * @param	string	
	 * @return	string
	 */
if ( ! function_exists('th_img_url'))
{
	function th_img_url($file = '')
	{
		$CI =& get_instance();
		$config =& get_config();
		$CI->load->helper('url');
		
		$base = base_url();
		$_img_path = $base.$config['th_img_path'];
		
		return $_img_path.'/'.$file;
	}
}
	// --------------------------------------------------------------------

	/**
	 * avatar file url
	 *
	 * 获得用户头像文件的url
	 *
	 * @param	string	
	 * @return	string
	 */
if ( ! function_exists('th_avatar_url'))
{
	function th_avatar_url($file = '')
	{
		$CI =& get_instance();
		$config =& get_config();
		$CI->load->helper('url');
		
		$base = base_url();
		$_avatar_path = $base.$config['th_avatar_path'];
		
		return $_avatar_path.'/'.$file;
	}

}
	/**
	 * base  url
	 *
	 * 根据传入的参数组装全路径
	 *
	 * @param	string	控制器名
	 * @param	string	方法名
	 * @param	array	参数
	 * @return	string
	 */
if ( ! function_exists('th_base_url'))
{
	function th_base_url($c = '',$m='',$array)
	{
		$CI =& get_instance();
		$config =& get_config();
		$CI->load->helper('url');
		
		$url = base_url();
		if ($c) {
			$url.='?c='.$c;
			if ($m) {
				$url.='&m='.$m;
				if ($array) {
					foreach ($array as $key => $value) {
						$url.='&'.$key.'='.$value;
					}
				}
				
			}
		}

		
		return $url;
	}

}
// END Th_url Class

/* End of file Th_url.php */